package com.example.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author YAO
 * @create 2021-05-13 16:45
 */
public class Filter1 implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("Filter1 前置代码");
        System.out.println("Filter1 线程：" + Thread.currentThread().getName());
        System.out.println("Filter1：" + request.getParameter("user"));
        request.setAttribute("key1","value1");
        chain.doFilter(request,response);

        System.out.println("Filter1 后置代码");
    }

    @Override
    public void destroy() {

    }
}
